package com.zzs.judge.pojo.other;

import com.zzs.common.core.enums.CodeSubmitStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户代码的编译结果
 * @author zzs
 * @date 2025/03/29
 */
@NoArgsConstructor
@Data
@AllArgsConstructor
@Builder
public class CompileResult {
    private int status;
    private String message;

    public static CompileResult pass() {
        return new CompileResult(CodeSubmitStatus.PASS.getStatus(), "");
    }

    public static CompileResult errorCompile(String message) {
        return new CompileResult(CodeSubmitStatus.ERROR_COMPILE.getStatus(), message);
    }

    public static CompileResult errorServer() {
        return new CompileResult(CodeSubmitStatus.ERROR_SERVER.getStatus(), CodeSubmitStatus.ERROR_SERVER.getMessage());
    }
}
